#ifndef MONO_CONFIG_SIMPLE_TOKENIZER_H_
#define MONO_CONFIG_SIMPLE_TOKENIZER_H_

#include <string>
#include <vector>
#include <map>

namespace mono {

typedef std::pair<int, std::string> Token;

enum BuiltinToken {
	TokenVerbatim = 1,
	TokenString,
	TokenNumeric,
	TokenUser = 20,
};

class SimpleTokenizer {
public:	
	void tokenize(const std::string & input, std::vector<Token> & output);
	void addToken(const std::string & ident, int value);
	void addVerbatim(const std::pair<std::string, std::string> & verbatim);
	void addComment(const std::pair<std::string, std::string> & comment);
	void addIgnore(const std::string & ignore);
	
private:
	typedef std::pair<std::pair<int, int>, int> VerbatimLength;
	
	int getIgnoreLength() const;
	VerbatimLength getVerbatimLength() const;
	Token getCustomToken() const;
	int getTokenType(const std::string & value) const;
	void addLastToken(std::vector<Token> & output) const;
	
	std::vector<std::string>                           _ignores;
	std::vector<std::pair<std::string, std::string> >  _verbatims;
	std::vector<std::pair<std::string, std::string> >  _comments;
	std::vector<Token >                                _customTokens;
	const char                                        *_currentChar;
	const char                                        *_lastToken;
};
}

#endif //MONO_CONFIG_SIMPLE_TOKENIZER_H_
